package com.simple.controller;

import com.simple.common.PageResult;
import com.simple.common.Result;
import com.simple.dto.BankDTO;
import com.simple.service.BankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName BillController
 * @Author SimpleTree
 **/
@RestController
@RequestMapping("/bank")
public class BankController {

    @Autowired
    private BankService bankService;

    @GetMapping
    public Result getBanks(BankDTO BankDTO) {
        return Result.of(bankService.getBanks(BankDTO));
    }

    @GetMapping("/getBankTypes")
    public Result getBankTypes() {
        return Result.of(bankService.getBankTypes());
    }

    @PostMapping
    public Result saveBank(@RequestBody BankDTO BankDTO) {
        bankService.saveBank(BankDTO);
        return Result.of();
    }

    @PutMapping
    public Result updateBank(@RequestBody BankDTO BankDTO) {
        bankService.updateBank(BankDTO);
        return Result.of();
    }

    @DeleteMapping
    public Result deleteByIds(@RequestParam List<Integer> ids) {
        bankService.deleteByIds(ids);
        return Result.of();
    }
}
